
<meta charset="utf-8">
<div class="box" id="biz_pmpProject_conatainer">
	<div class="box-header with-border">
		<form id="searchForm" role="form" class="form-inline">
			<div class="form-group">
				<label>项目名称</label> <input name="name" v-model="searchForm.name"
					type="text" placeholder="" class="form-control">
			</div>
			<div class="form-group">
				<label for="pmUserId" > 项目负责人</label>
				<select type="text" name="pmUserId" v-model="searchForm.pmUserId"
					v-kselect="{url:'/pmp/service/ma/pmpCloudMember/loadCloudMemberComboboVo',vmodel:'searchForm.pmUserId',firstEmpty:'true'}"
					class="form-control" id="pmUserId">
				</select>
			</div>
			<button type="button" class="btn btn-info pull-right m-t-n-xs" v-on:click="search">
				<strong>查询</strong>
			</button>
		</form>
	</div>
	<div class="box-body">
		<div class="row">
			<div class="col-md-12">
				<div class="btn-group " id="pmpProjectTableToolbar" role="group">
					<button type="button" v-kperms="{perm:''}" class="btn btn-default" v-on:click="add">
						<i class="glyphicon glyphicon-plus" aria-hidden="true"></i> 创建新项目
					</button>

					<button type="button" v-kperms="{perm:''}" class="btn btn-default" v-on:click="edit">
						<i class="glyphicon glyphicon-pencil" aria-hidden="true"></i> 修改信息
					</button>
					
					<button type="button" v-kperms="{perm:''}" class="btn btn-default" v-on:click="projectGroup">
						<i class="glyphicon glyphicon-user" aria-hidden="true"></i> 项目组
					</button>
					<button type="button" v-kperms="{perm:''}" class="btn btn-default" v-on:click="deletex">
						<i class="glyphicon glyphicon-trash" aria-hidden="true"></i> 删除项目
					</button>
					
					<button type="button" v-kperms="{perm:''}" class="btn btn-default" 	v-on:click="addC">
						<i class="glyphicon glyphicon-trash" aria-hidden="true"></i> 测试按钮
					</button>
				</div>
				<table id="pmpProjectBootstrapTable" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
</div>
<script>

    
var project_list_main=new Vue({  
	  el: '#biz_pmpProject_conatainer',
	  data:{
		  searchForm:{
			  name: null,
			  pmUserId: null
		 },
		  bus:new Vue(),
	  },
	  mounted:function(){
		  var _this=this;
		_this.initTable();
	  },
    methods: {
  	  initTable:function(){
  		var _this=this;
  		  var columns=[
  					{checkbox:true,width:20},
  					{field:'name',title:'项目名称',width:160},
  					{field:'version_name',title:'项目版本',width:60},
                    {field:'pm_user_name',title:'负责人',width:60},
					{field:'member_count',title:'项目组成员数',width:100},
					{field:'createTime',title:'创建时间',width:100},
					{field:'status',title:'当前状态',width:100,formatter:_this.formatStatus},
					{field:'',title:'项目入口',width:60,formatter:_this.formatEntry}]; 
  		  var url="/pmp/service/ma/pmpProject/loadPmpProjectDataSet";
    		zfesBstable.laodTable($("#pmpProjectBootstrapTable"),$("#searchForm"),$("#pmpProjectTableToolbar"),url,columns,this.searchForm);
  	  },
  	 addC: function (){
  		zfesRoutie.open("/views/pmpProject/pmpProject.add.html",{"id":12322},"添加",null);
	  },
  	  search:function(){
  		  zfesBstable.reload($("#pmpProjectBootstrapTable")); 
  	  },
  	  refresh:function(){
  		  zfesBstable.refresh($("#pmpProjectBootstrapTable"));
  	  },
  	  add:function(){
  		  var　_this=this;
  		 var url="/views/pmpProject/pmpProject.add.html";
  		 zfesLayerEditDg.open(url,{},"创建项目",460,function(){_this.refresh();});
  		 
  	  },
  	  edit:function(){
  		  if(zfesBstable.isOneRow($("#pmpProjectBootstrapTable"))){
  			  var　_this=this;
  			  var id=zfesBstable.getRowId($("#pmpProjectBootstrapTable"));
  			  var url="/views/pmpProject/pmpProject.edit.html";
  			  zfesLayerEditDg.open(url,{"id":id},"项目信息编辑",460,function(){_this.refresh();}); 
  		 }
  	  },

  	 projectGroup:function(){
 		  if(zfesBstable.isOneRow($("#pmpProjectBootstrapTable"))){
 			  var　_this=this;
 			  var id=zfesBstable.getRowId($("#pmpProjectBootstrapTable"));
 			  var url="/views/pmpProject/pmpProject.group.html";
 			  zfesLayerEditDg.open(url,{"projectId":id},"项目组成员",400,function(){_this.refresh();}); 
 		 }
 	  },
  	  deletex: function(){
  			if(zfesBstable.isSelectedRow($("#pmpProjectBootstrapTable"))){
  				  var　_this=this;
  				    var id=zfesBstable.getRowId($("#pmpProjectBootstrapTable"));
  					 alertSwal.confirm("删除","是否删除该项目",function(){
  						    var ajaxUrl = "/pmp/service/ma/pmpProject/setPmpProjectStatus";
  							zfesAjax.ajaxTodo(ajaxUrl, { "id" : id,"status":-1}, function(data) {
  								alertSwal.successText(data.message);
  								_this.refresh();
  							}); 
  				});
  			}
  				
  	  },
  	  formatStatus:function(value, row, index){
  		if("0"==value){
  			return '<span class="label label-info">未开始</span>';
  		}else if("1"==value){
  			return '<span class="label label-success">进行中</span>';
  		}else if("2"==value){
  			return '<span class="label label-warning">已结束</span>';
  		}else if("3"==value){
  			return '<span class="label label-danger">暂停中</span>';
  		}else if("4"==value){
  			return '<span class="label label-danger">已关闭</span>';
  		}else{
  			return '<span class="label label-danger">已删除</span>';
  		}
  	},
  	formatEntry: function(value, row, index){
  		return '<button type="button" class="btn btn-block btn-info btn-sm" onClick="entryProj('+row.id+')">进入</button>';
  	},
  	entryProj: function(id){
  		var url="/views/pmpProject/pmpProject.detail.html#id="+id+"";
  		zfesRoutie.load(url,{"id":id},"项目详情");
  	}
   	
   }
});

function entryProj(id){
	project_list_main.entryProj(id);
}


</script>


